package com.example.bookservice.controller;

import com.example.bookservice.service.ChapterService;
import com.example.feign.result.AjaxResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 软工2104-李家强-2100770248
 * @since 2023-09-20
 */
@RestController
@RequestMapping("/chapter")
public class ChapterController {

    @Autowired
    private ChapterService chapterService;

    @GetMapping("/{chapterId}")
    @ApiOperation(value = "测试接口1", notes = "通过id查询单个章节")
    public AjaxResult getChapterById(@PathVariable("chapterId") Long chapterId) {

        return AjaxResult.success(chapterService.getById(chapterId));
    }
}
